<?php

namespace Nim\Bundle\ModelBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;

use Doctrine\ORM\Mapping as ORM;

/**
 * Page
 *
 * @ORM\Table(name="page")
 * @ORM\Entity
 */
class Page
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var integer
     *
     * @ORM\Column(name="number", type="integer")
     */
    private $number;

    /**
     * @ORM\ManyToMany(targetEntity="Product")
     * @ORM\JoinTable(name="page_product",
     *      joinColumns={@ORM\JoinColumn(name="page_id", referencedColumnName="id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="product_id", referencedColumnName="id")}
     *      )
     **/
    private $products;
    
    /**
     * @ORM\ManyToOne(targetEntity="Image", inversedBy="pages")
     * @ORM\JoinColumn(name="image_id")
     */
    private $image;
    
    public function __construct()
    {
    	$this->image = new ArrayCollection();
    	$this->products = new ArrayCollection();
    }


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set number
     *
     * @param integer $number
     * @return Page
     */
    public function setNumber($number)
    {
        $this->number = $number;
    
        return $this;
    }

    /**
     * Get number
     *
     * @return integer 
     */
    public function getNumber()
    {
        return $this->number;
    }

    /**
     * Add products
     *
     * @param \Nim\Bundle\ModelBundle\Entity\Product $products
     * @return Page
     */
    public function addProduct(\Nim\Bundle\ModelBundle\Entity\Product $products)
    {
        $this->products[] = $products;
    
        return $this;
    }

    /**
     * Remove products
     *
     * @param \Nim\Bundle\ModelBundle\Entity\Product $products
     */
    public function removeProduct(\Nim\Bundle\ModelBundle\Entity\Product $products)
    {
        $this->products->removeElement($products);
    }

    /**
     * Get products
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getProducts()
    {
        return $this->products;
    }

    /**
     * Set image
     *
     * @param \Nim\Bundle\ModelBundle\Entity\Image $image
     * @return Page
     */
    public function setImage(\Nim\Bundle\ModelBundle\Entity\Image $image = null)
    {
        $this->image = $image;
    
        return $this;
    }

    /**
     * Get image
     *
     * @return \Nim\Bundle\ModelBundle\Entity\Image 
     */
    public function getImage()
    {
        return $this->image;
    }
}